package com.sh.data.engine.domain.shims.sql.select;

import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * @Auther: zigui.zdf @Date: 2019/9/10 09:37 @Description:
 */
public class ListRowMapper extends RowMapper<List<Object>> {

    @Override
    public List<Object> convert(ResultSet resultSet, int rowNum) throws SQLException {
        ResultSetMetaData metaData = resultSet.getMetaData();

        List<Object> rowValues = new ArrayList<>();

        for (int i = 1; i <= metaData.getColumnCount(); i++) {
            rowValues.add(resultSet.getObject(i));
        }

        return rowValues;
    }
}
